export default {
    namespaced: true,
    state: {
        isShowToast: false,
        msg: '',
        type: '',
    },
    mutations: {
        changeIsShowToast(state, payload) {
            // console.log(123);
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.msg = payload.msg;
                state.type = payload.type;
            }
            // console.log(state.isShowToast, state.msg, state.type);
        },
    },
    actions: {
        asyncChangeIsShowToast(context, payload) {
            // console.log(123);
            context.commit('changeIsShowToast', {
                isShow: true,
                msg: payload.msg,
                type: payload.type,
            });
            setTimeout(() => {
                context.commit('changeIsShowToast', {
                    isShow: false,
                });
            }, 1500);
        },
    },
};
